package com.atguli.gulimall.product.entity;

import com.atguli.common.valid.AddGroup;
import com.atguli.common.valid.ListValue;
import com.atguli.common.valid.UpdateGroup;
import com.atguli.common.valid.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author kotori
 * @email 1012403910@qq.com
 * @date 2021-01-18 21:00:54
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须携带品牌ID", groups = {UpdateGroup.class})
	@Null(message = "新增不能指定品牌ID ", groups = {AddGroup.class} )
	@TableId(type = IdType.AUTO)
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank( message = "品牌名必须提交", groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotEmpty(message = "品牌logo不能为空", groups = {AddGroup.class})
	@URL( message = "logo必须是一个合法的URL地址", groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态码不能为空", groups = UpdateStatusGroup.class)
	@ListValue(message = "显示状态码非法", vals = {0,1},groups = {AddGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(message = "检索首字母不能为空", groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-z]$", message = "首字母必须一个是a-z或者A-Z", groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序字段不能为空", groups = {AddGroup.class})
	@Min(value = 0, message = "排序字段必须是大于等于0的数字", groups = {AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
